package com.bird.设计模式.结构型.享元模式;

import javax.crypto.spec.DESedeKeySpec;
import java.util.HashMap;
import java.util.Map;

/**
 * @data 2022/3/15 14:39
 * @author: bird
 * @description: 员工工厂类 生成员工
 */
public class EmployeeFactory {

    private static final Map<String, Employee> EMPLOYEE_MAP = new HashMap<>();

    public static Employee getManager(String department) {
        Manager manager = (Manager) EMPLOYEE_MAP.get(department);
        if (manager == null) {
            manager = new Manager(department);
            System.out.println("创建部门经理: " + department);
            String reportContent = department + " 部门汇报: 此次报告主要内容是....";
            manager.setReportContent(reportContent);
            System.out.println("创建报告:" + reportContent);
            EMPLOYEE_MAP.put(department, manager);
         }
        return manager;
    }

}
